<?php 

require_once ('includes/config.inc.php'); 

// Start output buffering:
ob_start();

// Initialize a session:
@session_start();


// Check for a $page_title value:
if (!isset($page_title)) {
	$page_title = 'Create New Campaign';
}

// If no first_name session variable exists, redirect the user:
if (!isset($_SESSION['first_name'])) {
	
	$url = BASE_URL . 'index.php'; // Define the URL.
	ob_end_clean(); // Delete the buffer.
	header("Location: $url");
	exit(); // Quit the script.
	
}

include ('includes/header.html');

// change
if (isset($_POST['subject'], $_POST['message'] ) ) {
		
		if ( !empty($_POST['subject']) && !empty($_POST['message']) )
		{
			$_SESSION['subject'] = $_POST['subject'];
			$_SESSION['message'] = $_POST['message'];			
			header("Location: review.php");		
		}
		else
		{
			echo '<p class="error">Please fill in all fields.</p>';
		}

		
		
}
		  
		  

?>
<h2>Customize Your Campaign!</h2>
<form id="form1" name="form1" method="post" action="">
  <table width="100%" border="1" cellspacing="10" cellpadding="6">
    <tr>
      <td><label for="subject">Subject:</label></td>
      <td><input name="subject" type="text" id="subject" size="58" maxlength="50" /></td>
    </tr>
    <tr>
      <td><label for="message">Message (Max 160 characters)</label></td>
      <td><textarea name="message" id="message" cols="45" rows="5" maxlength="160"></textarea></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="send" id="send" value="Send Advertisement!" /></td>
    </tr>
  </table>
</form>



<?php // Include the HTML footer file:
include ('includes/footer.html');
ob_end_flush();
?>
